Skip to content

Reject malformed custom slippage input - #104

Merged
0takuc0mrade merged 2 commits into
Nodus-protocol:mainfrom
vku2018:grantfox-57-strict-slippage-input
Jul 23, 2026
Merged

Reject malformed custom slippage input#104
0takuc0mrade merged 2 commits into
Nodus-protocol:mainfrom
vku2018:grantfox-57-strict-slippage-input

Conversation

@vku2018

@vku2018 vku2018 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace partial parseFloat handling with a strict decimal parser for custom slippage input
  • reject malformed values such as 1abc, 1,5, 0.5%, exponent notation, zero, and values above 50 without calling onChange
  • show an invalid state for rejected custom values while preserving normal decimal entry with inputMode="decimal"
  • add focused component coverage for invalid and valid custom slippage values

Why

parseFloat accepts partial numeric prefixes, so malformed values can silently apply a different slippage than the text the user entered. This keeps displayed input and applied slippage aligned.

Closes #57.

Validation

  • npm run test -- __tests__/components/SlippageSelector.test.tsx
  • npm test -- --runInBand (26 tests passed)
  • npm run lint -- components/SlippageSelector.tsx __tests__/components/SlippageSelector.test.tsx
  • npm run typecheck
  • git diff --check

@vku2018
vku2018 requested a review from Jaydbrown as a code owner July 3, 2026 18:28
@0takuc0mrade
0takuc0mrade merged commit 337c2d0 into Nodus-protocol:main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants